const { DataTypes } = require('sequelize')
const sequelize = require('./db')

const Managers = sequelize.define(
  'Manager',
  {
    userName: {
      type: DataTypes.STRING,
      allowNull: false,
      comment: '用户名',
    },
    password: {
      type: DataTypes.STRING,
      allowNull: false,
      comment: '密码',
    },
    phone: {
      type: DataTypes.STRING,
      allowNull: false,
      comment: '手机号',
    },
    email: {
      type: DataTypes.STRING,
      allowNull: false,
      comment: '邮箱',
    },
    loginTime: {
      type: DataTypes.DATE,
      allowNull: false,
      defaultValue: DataTypes.NOW,
      comment: '登录时间',
    },
    loginStatus: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 0,
      comment: '登录状态',
    },
  },
  {
    tableName: 'Managers',
    timestamps: true,
    paranoid: true,
    comment: '执法人员信息表',
  }
)

module.exports = Managers
